//
//  tiXianRecordCell.m
//  DMGME
//
//  Created by MC on 15/10/10.
//  Copyright (c) 2015年 GYP. All rights reserved.
//

#import "tiXianRecordCell.h"
#import "DMTixianModel.h"
@implementation tiXianRecordCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //        [self setValuesForKeysWithDictionary:dic];
        /*
         @property (weak, nonatomic) UILabel *resultLabel;
         @property (weak, nonatomic) UILabel *moneySum;
         @property (weak, nonatomic) UILabel *timeLabel;
         @property (weak, nonatomic) UIButton *againApply;
         */
        UILabel *resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, KWidth/3*2, 15)];
        _resultLabel = resultLabel;
        resultLabel.text = [NSString stringWithFormat:@"提现结果:成功"];
        resultLabel.font = [UIFont systemFontOfSize:12];
        resultLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:resultLabel];
        
        UILabel *moneySum = [[UILabel alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(resultLabel.frame)+3, resultLabel.frame.size.width, 15)];
        _moneySum = moneySum;
        moneySum.text = @"提现金额:￥10";
        moneySum.font = [UIFont systemFontOfSize:12];
        moneySum.textColor = [UIColor grayColor];
        [self.contentView addSubview:moneySum];
        UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(moneySum.frame)+3, moneySum.frame.size.width*1.5, 15)];
        _timeLabel = timeLabel;
        timeLabel.text = @"提现时间:2015-10-10 10:13";
        timeLabel.font = [UIFont systemFontOfSize:12];
        timeLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:timeLabel];
        UIButton *againApply = [UIButton buttonWithType:UIButtonTypeSystem];
        againApply.frame = CGRectMake(self.contentView.frame.size.width/5*3.5, self.contentView.frame.size.height/2, self.contentView.frame.size.width/3, self.contentView.frame.size.height/2+10);
        _againApply = againApply;
        [againApply setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [againApply setTitle:@"再次申请" forState:UIControlStateNormal];
        againApply.backgroundColor = ComColor;
        againApply.layer.masksToBounds = YES;
        againApply.layer.cornerRadius = 2;
        [self.contentView addSubview:againApply];
        UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(timeLabel.frame)+5, KWidth, 1)];
        line.alpha = 0.6;
        line.backgroundColor = [UIColor lightGrayColor];
        [self.contentView addSubview:line];
    }
    return self;
}
-(void)setModel:(DMTixianModel *)model
{
    _model = model;

    if (model.status.intValue == 1) {
        
        _resultLabel.text = [NSString stringWithFormat:@"提现结果:成功"];
    }else
    {
        _resultLabel.text = [NSString stringWithFormat:@"提现结果:失败"];
    }
    _moneySum.text = [NSString stringWithFormat:@"提现金额:￥%@",model.money];
    
    _timeLabel.text = [NSString stringWithFormat:@"提现时间:%@",[self timeStamaps:model.update_time]];
 
}
-(NSString *)timeStamaps:(NSString *)str
{
    //时间戳转化为时间字符串
    NSDate *date = [[NSDate alloc] initWithTimeIntervalSince1970:[str longLongValue]];
    NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *string = [formatter stringFromDate:date];
    //    NSLog(@"date1:%@",str);
    return string;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
